package 字符串;

public class StringBuider {
    public static void main(String[] args) {
        StringBuilder sbu=new StringBuilder(5);
        System.out.println(sbu.length());
        sbu.append("java");
        sbu.append("hello");
        System.out.println(sbu);//println会自动调用toString()
        System.out.println(sbu.length());
       // String str=sbu;错误的,赋值不会自动调用
        //StringBuilder 转化为 String
        String str= sbu.toString();
        System.out.println(str);
        //helloworld是静态字符串但是能转成动态字符串
        StringBuilder sbu2=new StringBuilder("helloworld");
        sbu2.delete(5,sbu2.length());
        System.out.println(sbu2);

    }
}
